<html>
<head><meta charset="utf-8"><title>mismatch between module and crate with same name #80255 · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html">mismatch between module and crate with same name #80255</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="220833254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220833254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pierwill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220833254">(Dec 23 2020 at 22:33)</a>:</h4>
<p>Can this issue be solved with the data currently available? We wouldn't need to add a parameter to the fn, would we?</p>



<a name="220833266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220833266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220833266">(Dec 23 2020 at 22:33)</a>:</h4>
<p><span class="user-mention" data-user-id="316352">@pierwill</span> <code>report_maybe_different</code> does not have enough info to give a useful error</p>



<a name="220833272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220833272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220833272">(Dec 23 2020 at 22:34)</a>:</h4>
<p>I would look how this is done for version mismatches</p>



<a name="220833273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220833273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pierwill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220833273">(Dec 23 2020 at 22:34)</a>:</h4>
<p>Cool. Thought so :)</p>



<a name="220833496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220833496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pierwill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220833496">(Dec 23 2020 at 22:38)</a>:</h4>
<blockquote>
<p>version mismatch</p>
</blockquote>
<p>Either of these two? <a href="https://doc.rust-lang.org/nightly/nightly-rustc/?search=version_mismatch">https://doc.rust-lang.org/nightly/nightly-rustc/?search=version_mismatch</a></p>
<p>Are we maybe intersted in a <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/diagnostic_builder/struct.DiagnosticBuilder.html">DiagnosticBuilder</a>?</p>



<a name="220833561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220833561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220833561">(Dec 23 2020 at 22:39)</a>:</h4>
<p>yes, <a href="https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_trait_selection/traits/error_reporting/mod.rs.html#1396-1423">https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_trait_selection/traits/error_reporting/mod.rs.html#1396-1423</a> looks right</p>



<a name="220833593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220833593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220833593">(Dec 23 2020 at 22:40)</a>:</h4>
<blockquote>
<p>Are we maybe intersted in a DiagnosticBuilder?</p>
</blockquote>
<p>that's how you actually emit the error, the tricky bit is knowing when to give the help</p>



<a name="220833634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220833634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pierwill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220833634">(Dec 23 2020 at 22:40)</a>:</h4>
<p>Ah</p>



<a name="220833638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220833638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220833638">(Dec 23 2020 at 22:40)</a>:</h4>
<p>which it looks like that's not actually part of that function - I'd see where it's called</p>



<a name="220833654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220833654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pierwill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220833654">(Dec 23 2020 at 22:40)</a>:</h4>
<p>Hoo boy this Medium, not Easy huh</p>



<a name="220833659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220833659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pierwill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220833659">(Dec 23 2020 at 22:41)</a>:</h4>
<p>lol</p>



<a name="220833670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220833670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220833670">(Dec 23 2020 at 22:41)</a>:</h4>
<p>oh wait no sorry, that is part of the function - the <code>for</code> loop is looping over things with the same name</p>



<a name="220833679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220833679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220833679">(Dec 23 2020 at 22:41)</a>:</h4>
<p>heh, you should see what E-hard looks like <span aria-label="joy" class="emoji emoji-1f602" role="img" title="joy">:joy:</span></p>



<a name="220833683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220833683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220833683">(Dec 23 2020 at 22:41)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/73566">https://github.com/rust-lang/rust/pull/73566</a></p>



<a name="220833744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220833744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pierwill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220833744">(Dec 23 2020 at 22:42)</a>:</h4>
<p><span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<a name="220834059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220834059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pierwill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220834059">(Dec 23 2020 at 22:48)</a>:</h4>
<p>so instead of  <code>for trait_with_same_path in traits_with_same_path</code>, we want to construct something  like <code>for type_err_with_same_X in type_errs_with_same_X</code>?</p>



<a name="220834074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220834074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pierwill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220834074">(Dec 23 2020 at 22:48)</a>:</h4>
<p>Still not sure what X is...</p>



<a name="220834091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220834091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220834091">(Dec 23 2020 at 22:49)</a>:</h4>
<p>X is <code>def_path</code></p>



<a name="220834106"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220834106" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220834106">(Dec 23 2020 at 22:49)</a>:</h4>
<p><a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.def_path_str">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.def_path_str</a></p>



<a name="220834107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220834107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pierwill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220834107">(Dec 23 2020 at 22:49)</a>:</h4>
<p>Sweet thanx</p>



<a name="220834129"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220834129" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220834129">(Dec 23 2020 at 22:49)</a>:</h4>
<p>but this function is the wrong place to do it, because this error is only emitted when a type doesn't implement a trait</p>



<a name="220834195"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220834195" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220834195">(Dec 23 2020 at 22:50)</a>:</h4>
<p>it has the right approach, you need to use the same approach in TypeError</p>



<a name="220834208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220834208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pierwill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220834208">(Dec 23 2020 at 22:50)</a>:</h4>
<p>yep</p>



<a name="220834320"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220834320" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220834320">(Dec 23 2020 at 22:53)</a>:</h4>
<blockquote>
<p>@pierwill Note that this issue will likely be tricky to fix!</p>
</blockquote>
<p><span class="user-mention" data-user-id="307537">@Camelid</span> oh now you say something <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="220834520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220834520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pierwill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220834520">(Dec 23 2020 at 22:56)</a>:</h4>
<p>Seeing now that I won't be able to do it on my own. Might remove assignment.</p>
<p>Do folks link to Zulip discussions in issues for others to take things up?</p>



<a name="220834529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220834529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pierwill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220834529">(Dec 23 2020 at 22:56)</a>:</h4>
<p>My questions might be useful to others.</p>



<a name="220834556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220834556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220834556">(Dec 23 2020 at 22:57)</a>:</h4>
<p><span class="user-mention silent" data-user-id="316352">pierwill</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255/near/220834520">said</a>:</p>
<blockquote>
<p>Seeing now that I won't be able to do it on my own. Might remove assignment.</p>
<p>Do folks link to Zulip discussions in issues for others to take things up?</p>
</blockquote>
<p>I wouldn't say that, I think you're on the right track</p>



<a name="220834567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220834567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220834567">(Dec 23 2020 at 22:57)</a>:</h4>
<p>but yeah linking to zulip sounds fine, I do that a lot</p>



<a name="220834629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220834629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pierwill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220834629">(Dec 23 2020 at 22:58)</a>:</h4>
<p>Yeah perhaps I should give fixing a compiler issue more than like 30 minutes lol</p>



<a name="220834746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220834746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220834746">(Dec 23 2020 at 23:00)</a>:</h4>
<p><span class="user-mention silent" data-user-id="316352">pierwill</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255/near/220834629">said</a>:</p>
<blockquote>
<p>Yeah perhaps I should give fixing a compiler issue more than like 30 minutes lol</p>
</blockquote>
<p>if it makes you feel better, I've been working on <a href="https://github.com/rust-lang/rust/pull/79540">https://github.com/rust-lang/rust/pull/79540</a> for like 3 weeks lol</p>



<a name="220834894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220834894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pierwill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220834894">(Dec 23 2020 at 23:02)</a>:</h4>
<p>Notes:</p>
<div class="codehilite"><pre><span></span><code>impl&lt;&#39;tcx&gt; fmt::Display for TypeError&lt;&#39;tcx&gt; {
    fn fmt(&amp;self, f: &amp;mut fmt::Formatter&lt;&#39;_&gt;) -&gt; fmt::Result {
        use self::TypeError::*;
        fn report_maybe_different(
            db: &amp;mut DiagnosticBuilder&lt;&#39;_&gt;,
            f: &amp;mut fmt::Formatter&lt;&#39;_&gt;,
            expected: &amp;str,
            found: &amp;str,
        ) -&gt; fmt::Result {

            // USE THIS:
            // https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.def_path_str

            self.tcx.def_path_str()

            // CONSTRUCT SOMETHING LIKE THIS
            //     let get_trait_impl = |trait_def_id| {
            //         self.tcx.find_map_relevant_impl(trait_def_id, trait_ref.skip_binder().self_ty(), Some)
            //     };
            //     let required_trait_path = self.tcx.def_path_str(trait_ref.def_id());
            //     let all_traits = self.tcx.all_traits(LOCAL_CRATE);
            //     let traits_with_same_path: std::collections::BTreeSet&lt;_&gt; = all_traits
            //         .iter()
            //         .filter(|trait_def_id| **trait_def_id != trait_ref.def_id())
            //         .filter(|trait_def_id| self.tcx.def_path_str(**trait_def_id) == required_trait_path)
            //         .collect();


            // THEN DO A FOR LOOP
            //     for type_error_with_same_path in type_errors_with_same_path {
            //
            //
            //         if let Some(impl_def_id) = get_trait_impl(*trait_with_same_path) {
            //             let impl_span = self.tcx.def_span(impl_def_id);
            //             err.span_help(impl_span, &quot;trait impl with same name found&quot;);
            //             let trait_crate = self.tcx.crate_name(trait_with_same_path.krate);
            //
            //
            //
            //             let crate_msg = format!(
            //                 &quot;crate and module {} have same name&quot;,
            //                 collided_name
            //             );
            //             err.note(&amp;crate_msg);
            //         }
            //     }
            // }

            // A naive approach to making sure that we&#39;re not reporting silly errors such as:
            // (expected closure, found closure).
            if expected == found {
                write!(f, &quot;expected {}, found a different {}&quot;, expected, found)
            } else {
                write!(f, &quot;expected {}, found {}&quot;, expected, found)
            }
        }
</code></pre></div>



<a name="220834977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220834977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pierwill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220834977">(Dec 23 2020 at 23:04)</a>:</h4>
<p>So the end goal is something like </p>
<div class="codehilite"><pre><span></span><code>    let crate_msg = format!(
            //                 &quot;crate and module {} have same name&quot;,
            //                 collided_name
            //             );
</code></pre></div>
<p>yes?</p>



<a name="220834996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220834996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pierwill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220834996">(Dec 23 2020 at 23:04)</a>:</h4>
<p>Obviously all the trait-specific stuff in that code will be replaced...</p>



<a name="220835029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220835029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220835029">(Dec 23 2020 at 23:05)</a>:</h4>
<p>Yeah, that sounds about right</p>



<a name="220835034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220835034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220835034">(Dec 23 2020 at 23:05)</a>:</h4>
<p>And preferably say which is which, that's the main thing I wanted</p>



<a name="220838669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220838669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pierwill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220838669">(Dec 24 2020 at 00:05)</a>:</h4>
<p>Huh. I need <code>DefId</code>s to get <code>DefPath</code>s... Where will I get the needed <code>DefId</code>s? From a method on <code>tcx</code>? Maybe using the <code>expected</code> and <code>found</code> parameters?</p>



<a name="220838887"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220838887" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pierwill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220838887">(Dec 24 2020 at 00:08)</a>:</h4>
<p>Can I do <code>self.tcx</code> methods in the body of <code>report_maybe_different</code>? Will that play a part in all this?</p>



<a name="220840455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220840455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pierwill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220840455">(Dec 24 2020 at 00:47)</a>:</h4>
<p>Okay this is very fun brain-hurting stuff. But I might have to stick to docs for now! <span aria-label="innocent" class="emoji emoji-1f607" role="img" title="innocent">:innocent:</span> <span aria-label="beginner" class="emoji emoji-1f530" role="img" title="beginner">:beginner:</span></p>



<a name="220843445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220843445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220843445">(Dec 24 2020 at 02:04)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255/near/220834320">said</a>:</p>
<blockquote>
<blockquote>
<p>@pierwill Note that this issue will likely be tricky to fix!</p>
</blockquote>
<p><span class="user-mention silent" data-user-id="307537">Camelid</span> oh now you say something <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>
</blockquote>
<p>I didn't even know you guys were talking about it on Zulip! I just saw that pierwill claimed it and thought it might be worth mentioning that it's hard :)</p>



<a name="220843463"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/220843463" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#220843463">(Dec 24 2020 at 02:05)</a>:</h4>
<p><span class="user-mention silent" data-user-id="316352">pierwill</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255/near/220840455">said</a>:</p>
<blockquote>
<p>Okay this is very fun brain-hurting stuff. But I might have to stick to docs for now! <span aria-label="innocent" class="emoji emoji-1f607" role="img" title="innocent">:innocent:</span> <span aria-label="beginner" class="emoji emoji-1f530" role="img" title="beginner">:beginner:</span></p>
</blockquote>
<p>Working on compiler docs is very helpful, so thanks :)</p>



<a name="221113654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mismatch%20between%20module%20and%20crate%20with%20same%20name%20%2380255/near/221113654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255.html#221113654">(Dec 29 2020 at 05:46)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255/near/220834746">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="316352">pierwill</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/mismatch.20between.20module.20and.20crate.20with.20same.20name.20.2380255/near/220834629">said</a>:</p>
<blockquote>
<p>Yeah perhaps I should give fixing a compiler issue more than like 30 minutes lol</p>
</blockquote>
<p>if it makes you feel better, I've been working on <a href="https://github.com/rust-lang/rust/pull/79540">https://github.com/rust-lang/rust/pull/79540</a> for like 3 weeks lol</p>
</blockquote>
<p>I said a week ago <span aria-label="sob" class="emoji emoji-1f62d" role="img" title="sob">:sob:</span> and it will probably be just as long before it's merged at this rate, I found three more bugs just tonight</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>